package com.heg.bk.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.heg.bk.dao.MybatisBaseDao;
import com.heg.bk.service.SmsManagerService;
import com.comm.util.pages.PageUtils;

/**
 * 短信平台业务逻辑层(实现层)
 * @author dengxuzhao
 * @time 2016-05-01
 * @version 1.0.1
 */
@Service("smsManagerServiceImpl")
public class SmsManagerServiceImpl implements SmsManagerService {
	
	@Resource
	private MybatisBaseDao mybatisDao;

	public PageUtils select_smsToPage(String smsstatus, String type,
			Integer currPage, Integer pageSize, Integer totalRecord) {
		Map<String, Object> paramsMap = new HashMap<String, Object>();
		PageUtils pageUtils = new PageUtils(currPage, pageSize, totalRecord);
		paramsMap.put("smsstatus", smsstatus);
		paramsMap.put("type", type);
		paramsMap.put("pageSize", pageSize);
		paramsMap.put("currPage", (currPage - 1) * pageSize);
		List lst = mybatisDao.selectList(paramsMap, "hegSmsSpace.searchSmsByPage");
		pageUtils.setRetLst(lst);
		return pageUtils;
	}

	public Integer select_smsToRecord(String smsstatus, String type) {
		Map<String, Object> paramsMap = new HashMap<String, Object>();
		paramsMap.put("smsstatus", smsstatus);
		paramsMap.put("type", type);
		List lst = mybatisDao.selectList(paramsMap, "hegSmsSpace.searchSmsByTotalRecord");
		return lst != null && lst.size() > 0 ? Integer.parseInt(lst.get(0).toString()) : 0;
	}

}
